#ifndef _MCONFIG_H_
#define _MCONFIG_H_

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define MAX_LINE_BUF		256


class cfg_file
{
public:
	static cfg_file* instance();
	
	void set_file(const char* file);
	const char* get_file();

	char* get(const char* key);
	bool set(const char* key, const char* val);
	int get_int(const char* key, int fault_val);
	float get_float(const char* key, float fault_val);
	bool set_int(const char* key, int val);
	bool set_float(const char* key, float val);
	
public:
	~cfg_file();

protected:
	cfg_file();

	char* trim(char* s);
	char* ltrim(char* s);
	char* rtrim(char* s);
	
private:
	static cfg_file*	_inst;
	char*	_file;
	char	_buf[MAX_LINE_BUF];
};

#endif // _CONFIG_H_

